#encoding:utf-8
'''
Created on 2012/2/27
argv[1]為刪除0之後的data
argv[2]為class的data
argv[3]為最後結合起來的data，形式為A12,A45,...,C4,C8
@author: Netdb_Heng
'''
#參數一為母體，參數二為輸入Label，參數三為輸出sample，參數四為輸出sample的class，參數五為筆數

import sys

print ( sys.argv[1] + " to " + sys.argv[3] )

attribute_inf = open(sys.argv[1])
class_inf = open(sys.argv[2])

outf = open(sys.argv[3],'w')

attribute_lines = attribute_inf.readlines()
class_lines = class_inf.readlines()

instance=0

for i in range(len(attribute_lines)):
    attributeData = attribute_lines[i].split()
    classData = class_lines[i].split(",")
    for j in range(len(attributeData)):
        if j==0:
            outf.write("A"+attributeData[j].split(":")[0])
        else:
            outf.write("," + "A" + attributeData[j].split(":")[0])
    for j in range(len(classData)):
        outf.write("," + "C" + str(int(classData[j])) )
    outf.write("\n")
       
attribute_inf.close();
class_inf.close();
outf.close();

